var getRow = function (rowIndex) {
  let res = [],
    triangle = [];
  for (let i = 0; i < rowIndex + 1; i++) {
    triangle = res;
    res = [];
    res[0] = 1;
    res[i] = 1;
    if (i > 1) {
      for (let j = 1; j < i; j++) {
        res[j] = triangle[j - 1] + triangle[j];
      }
    }
  }
  return res;
};
